package com.party.core.model.member;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by wei.li.
 *
 * @date 2018/2/6 0006
 * @time 14:55
 */
public enum MemberType {

    PERSONAL(1, "个人用户"),

    GROUP(2, "机构用户"),

    PLATFORM(3, "平台用户");

    private Integer code;

    private String value;

    MemberType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code){
        for (MemberType memberType : MemberType.values()){
            if (memberType.getCode().equals(code)){
                return memberType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (MemberType memberType : MemberType.values()){
            map.put(memberType.getCode(), memberType.getValue());
        }
        return map;
    }
}
